Lumber is sorted and classified primarily on the basis of the number of knots therein. The closest prior art to the present invention is represented by the Bennion and West U.S. Pat. No. 3,810,005, May 7, 1974. In this patent, microwave radiation is passed through the lumber as it is moved past the source of wave, and two detectors receive the microwave radiation passing through the lumber. Signals on each detector are separately amplified and then are joined and amplified in a variable gain differential amplifier. When a knot passes, there is a sudden change in intensity received by the two detectors, and the differential amplifier then gives a signal which is used to trigger a marking device on the lumber. There is a level sensing device which differentiates between gradual changes and the sudden change when a knot passes. Thus different degrees of moisture in the lumber can be cancelled out, and a false knot indication is not given.